import * as Sequelize from 'sequelize';
import sequelize from './../core/mysqlDb';

export interface Product {
    id: number;
    facilityId:string;//仓库编码
    picklistId:string;//领料单号
    orderId:string;//订单号
    productName:string;//商品名称
    productCode:string;//商品编码
    unit:string;//单位
    quantity:number//数量
    pickedQuantity:number//已领取数量
    orderItemSeqId :string //订单商品行号
}
export interface Productstance extends Sequelize.Instance<Product>, Product {
}
// export const productModel = sequelize.define<Productstance, Product>('product', {
//     facilityId:Sequelize.STRING,
//     picklistId:Sequelize.STRING,
//     orderId:Sequelize.STRING,
//     productName:Sequelize.STRING,
//     productCode:Sequelize.STRING,
//     unit:Sequelize.STRING,
//     quantity:Sequelize.DOUBLE,
//     pickedQuantity:Sequelize.DOUBLE,
//     orderItemSeqId :Sequelize.STRING
// });

export const productModel = sequelize.define('product', {
    facilityId:Sequelize.STRING,
    picklistId:Sequelize.STRING,
    orderId:Sequelize.STRING,
    productName:Sequelize.STRING,
    productCode:Sequelize.STRING,
    unit:Sequelize.STRING,
    quantity:Sequelize.DOUBLE,
    pickedQuantity:Sequelize.DOUBLE,
    orderItemSeqId :Sequelize.STRING
});

productModel.sync();
export default productModel;
